package thread.demo07.test2;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 解决方案1：使用execute（）代替submit（）；
 * 
 * @author mengzhang6
 *
 */
public class ThreadPoolDemo2 {
	public static void main(String[] args) {

		ExecutorService executorService = Executors.newFixedThreadPool(4);

		for (int i = 0; i < 5; i++) {
			int index = i;
			executorService.execute(() -> divTask(100, index));
		}
		executorService.shutdown();
	}

	private static void divTask(int a, int b) {
		double result = a / b;
		System.out.println(result);
	}
}
